package com.liuwei.msmall.auth.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Classname MyMvcConfig
 * @Description TODO
 * @Date 2020/6/24 1:37
 * @Created by 刘
 */
@Configuration
public class MyMvcConfig implements WebMvcConfigurer {

    /**
     * 向容器中添加一些只用来跳转页面的controller,而不需要用来向页面携带数据的
     * 默认只接受get请求方式
     * 这样和业务逻辑处理的controller分离
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/login.html").setViewName("login");
        registry.addViewController("/register.html").setViewName("register");
    }
}
